<template>
    <div class="ad-popup" v-if="show">
      <div class="ad-content">
        <span class="close-btn" @click="closePopup">×</span>
        <img src="../assets/y.png" alt="广告">
        <button @click="closePopup">我知道了</button>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    data() {
      return {
        show: true
      }
    },
    methods: {
      closePopup() {
        this.show = false;
        // 可以在这里设置cookie或localStorage，记录用户已看过广告
        localStorage.setItem('hasSeenAd', 'true');
      }
    }
  }
  </script>
  
  <style scoped>
  .ad-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .ad-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    position: relative;
    width: 80%;
    max-width: 500px;
  }
  
  .ad-content img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
  }
  
  .close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
  }
  
  .ad-content button {
    margin-top: 15px;
    padding: 8px 15px;
    background-color: #0097FF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }
  </style>